<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\models\Branches;
use backend\models\Companies;

/* @var $this yii\web\View */
/* @var $model backend\models\Departments */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="departments-form">

    <?php $form = ActiveForm::begin(); ?>

    <?php   // $form->field($model, 'branches_branch_id')->textInput() ?>

    <?= $form->field($model, 'branches_branch_id')->dropDownList(
        Branches::find()
       ->select(['branch_name','branch_id'])
       ->indexBy('branch_id')
       ->column()
     ) ?>

    <?= $form->field($model, 'departments_name')->textInput(['maxlength' => true]) ?>

    <?php // $form->field($model, 'companies_company_id')->textInput() ?>

    <?= $form->field($model, 'companies_company_id')->dropDownList(
        Companies::find()
        ->select(['company_name','company_id'])
        ->indexBy('company_id')
        ->column()
    ) ?>

    <?php // echo $form->field($model, 'departments_created_time')->textInput() ?>

    <?= $form->field($model, 'departments_status')->dropDownList([ 'active' => 'Active', 'inactive' => 'Inactive', ], ['prompt' => '']) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
